package com.wsm.consumer.controller;

import com.wsm.common.dto.request.DtoRequest;
import com.wsm.common.dto.response.DtoResponse;
import com.wsm.consumer.business.ConsumerBiz;
import com.wsm.common.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author ：wangshimin
 * @date ：Created in 2020-10-29 下午 05:41
 * @description：
 * @version:
 */
@Slf4j
@RestController
@Api(tags = "测试接口集合")
public class Controller {

    @Autowired
    ConsumerBiz consumerBiz;

    @ApiOperation("测试接口-feign调用")
    @RequestMapping(value = "/getTestByFeign", method = RequestMethod.POST)
    public Result<DtoResponse> getTestByFeign(@Valid @RequestBody DtoRequest dtoRequest) throws Exception {
        return Result.ok(consumerBiz.getTestByFeign(dtoRequest));
    }

    @ApiOperation("测试接口--dubbo调用")
    @RequestMapping(value = "/getTestByDubbo", method = RequestMethod.POST)
    public Result<DtoResponse> getTestByDubbo(@Valid @RequestBody DtoRequest dtoRequest) {
        return Result.ok(consumerBiz.getTestByDubbo(dtoRequest));
    }
}
